<!DOCTYPE html>
<html lang="en">
<head>
    <title>消息日志</title>
    <#include "../inc/header.ftl"/>
</head>

<body class="no-skin">

<div class="main-container ace-save-state" id="main-container">

    <div class="main-content">
        <div class="main-content-inner">

            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <table id="MainGrid"></table>
                        <div id="toolbar">
                            <div style="padding:8px">
                                发送时间：<input id="senddate" name="senddate" class="easyui-datebox" editable="false" style="width:140px">
                                消息类型<select name="action" id="action" >
                                    <option value="SETCHARGEBILLDEPOSIT">缴款书收款</option>
                                    <option value="SETCHARGEBILLMANUAL">手工缴款书收款</option>
                                    <option value="SETCHARGEBILLBACKOUT">缴款书冲销</option>
                                    <option value="SETBACKBILLDEPOSIT">退付书收款</option>
                                    <option value="SETBACKBILLBACKOUT">退付书冲销</option>
                                    <option value="SETWAITAFFIRM">发送待查收入</option>
                                    <option value="CLEANWAITAFFIRM">清除待查收入</option>
                                    <option value="RESETWAITAFFIRMINFO">更新待查收入</option>
                                    <option value="SETBANKPOSDETAIL">发送POS明细</option>
                                    <option value="SETBANKPOSDETAILBACKOUT">POS明细冲销</option>
                                    <option value="SETBANKPAYFISC">国库收款</option>
                                    <option value="SETBANKPAYFISCBACKOUT">国库冲销</option>
                                    <option value="SETBANKPAYSPECIAL">专户收款</option>
                                    <option value="SETBANKPAYSPECIALBACKOUT">专户冲销</option>
                                    <option value="SETBANKPAYDIVIDE">分成收款</option>
                                    <option value="SETBANKPAYDIVIDEBACKOUT">分成冲销</option>
                                    <option value="SETDEDUCT">批扣发送</option>
                                    <option value="SETDEDUCTBACKOUT">批扣冲销</option>
                                    <option value="SETSTUDENTPAYINFO">学生缴费收款</option>
                                    <option value="SETSTUDENTBACKOUT">学生缴费冲销</option>
                                    <option value="SETPAYINFO">交警收款</option>
                                    <option value="SETPUNISHBILLNUM">交警补票</option>
                                    <option value="SETBANKILLEGALACTIVITYSCALEINFO">交警二八分成收款</option>
                                    <option value="SETBANKILLEGALACTIVITYSCALEINFOBACKOUT">交警二八分成冲销</option>
                                    <option value="SETPUNISHINFO">通用罚没发送</option>
                                    <option value="SETPUNISHINFOBACKOUT">通用罚没冲销</option>
                                    <option value="SETBANKBALANCE">发送余额</option>
                                    <option value="SETBANKBILLCHECK">发送对账流水</option>
                                    <option value="CLEANBANKCHECKBILL">清除对账流水</option>
                                    <option value="GETCHECKDATA">获取财政对账信息</option>
                                </select>
                                类型:<select name="types" id="types" >
                                <option value="1">发送</option>
                                <option value="0">接收</option>
                                </select>
                                <a href="#" onclick="javascript:searchInfo()" class="easyui-linkbutton" iconCls="icon-search" >查 询</a>
                                <a href="#" onclick="javascript:sendData()" class="easyui-linkbutton" iconCls="icon-search" >修改状态</a>

                            </div>
                        </div>
                    </div>
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
</div><!-- /.main-container -->

<!-- basic scripts -->
<#include "../inc/basicjs.ftl"/>

<!-- inline scripts related to this page -->
<script type="text/javascript">

    jQuery(function ($) {
        var curr_time = new Date();
        var str = curr_time.getFullYear()+"-";
        str += curr_time.getMonth()+1+"-";
        str += curr_time.getDate()+"-";
        $('#senddate').datebox('setValue',str);
        listPage();
    });

    function searchInfo() {
        listPage(prefix + '/query/queryMessageLog')
    }
    function listPage(url) {
        var action = $('#action').val();
        var senddate = $('#senddate').val();
        var types  = $('#types').val();
        $('#MainGrid').datagrid({
            url: url,
            checkbox: true,
            pagination: true,
            fitColumns:false,
            striped: true,
            singleSelect: false,
            loadMsg: "正在加载数据，请稍后...",
            queryParams: {action:action,senddate:senddate,types:types},
            columns:[[
                { title: '消息类型', field : 'action', width: 200},
                { title: '发送时间', field : 'createtime', width: 200},
                { title: 'SN', field : 'sn', width: 300},
                { title: '日志文件路径', field : 'filepath', width: 300},
                { title: '状态', field : 'state', width: 80}
            ]],
            toolbar: '#toolbar'
        });

        $(window).resize(function() {
            $('#MainGrid').datagrid('resize');
        });
    }

    function sendData() {
        var row = $('#MainGrid').datagrid('getSelected');
        if (row == null) {
            $.messager.alert('提示', '请选择要编辑的数据', 'info');
            return;
        }
        $.ajax({
            url: prefix + '/query/updateMessageState',
            type: 'POST',
            data: {messageid: row.messageid},
            dataType: 'json',
            success: function (data) {
                if (data.success) {
                    $('#form-update').form('load', data.data);
                    showForm();
                } else {
                    $.messager.alert('提示', data.msg, 'info');
                }
            }
        });
    }


</script>
</body>
</html>
